<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sb" uri="/struts-bootstrap-tags"%>
<%@ include file="/page/common/admHeader.jsp" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>大类管理列表</title>
<script type="text/javascript" src="<%=basePath%>js/tablecreate/jlinq.js"></script>
<script type="text/javascript" src="<%=basePath%>js/tablecreate/jquery-dynamicTable.js"></script>
<script type="text/javascript" src="<%=basePath%>js/tablecreate/pager.js"></script> 
<script type="text/javascript" src="<%=basePath%>js/tablecreate/modal.js"></script>

<style type="text/css">
a:LINK{text-decoration: none;color:black;}
a:visited {text-decoration:none ; color:black;}
a:hover {text-decoration:underline ; color:black;}
a:active {text-decoration:none ; color:black;} 
</style>
<sb:head/>
</head>
<body  onload="adminSupTypeList()">

<h3>大类列表</h3>
<div>
<input class="btn btn-info" onclick="plus('supType_editSupType')" type="button" value="添加大类" />
<input placeholder="请输入大类名称" id="supName" class="input-medium search-query" name="supVale" value=""/>
<input type="button" class="btn btn-success" id="" onclick="searchList()" value="查询"/>
</div>
<div id="lists">
<div id="list" ></div>
<div id="page"></div>
</div>
<script type="text/javascript">
var url=[{loadUrl:"supType_getSupTypes",editUrl:"<%=basePath%>adm/supType_editSupType?supId=",stopUrl:""}];//请求地址
var postData={supVale:$("#supName").val()};
var pageId="page";
var objClassName="list_light";
var objColumn = [
					{ ColumnName: "大类名称", DataId: "supName", Width: 200, DataAlign: "left", Format: null, OnClick: null },
					{ ColumnName: "创建时间", DataId: "created", Width: 100, DataAlign: "left", Format: null, OnClick: null },
					{ ColumnName: "操作", DataId: "Operation", Width: 200, DataAlign: "left", Format: null, OnClick: null },
                 ];
function adminSupTypeList(){
	   $.ajax({
			type: "post",
	        url: url[0].loadUrl,
	        data: postData,
	        dataType: "json",
	        success: function(data){
          var objData = new Array(data.list.length);
          for(var i=0;i<data.list.length;i++){
         	  var op="<a class='edit'onclick=\"edit('"+url[0].editUrl+""+data.list[i].supId+"')\" title=\"编辑\" href=\"javascript:void(0)\" id='"+data.list[i].supId+"'>编辑</a>&nbsp;&nbsp;<a href='subType_subTypeList?supId="+data.list[i].supId+"' target='_bank'>所属小类</a>&nbsp;&nbsp;<a href='menu_menuList?supId="+data.list[i].supId+"' target='_bank'>所属菜单</a>";
              
       	  objData[i]={supName:data.list[i].supName,created:data.list[i].created,
                	Operation:op}; 
              }
               $("#list").MakeTable(objColumn, objData, objClassName);
        	  $("#page").MakePage(data.page[0]);
		        }
			});
	   }
function searchList(){
	var page=$("#selPage").val();
	var pageRow=$("#selRow").val();
	postData={supVale:$("#supName").val(),initPage:page,pageRow:pageRow};
	adminSupTypeList();
}
var j=0;
function OrderSort(order){
	var order=order;
	j++;
	if(j%2==0){
          var sort="desc";
		}else if (j%3==0) {
			var sort="asc";
		}else{
      order="created";
      var sort="desc";
			}
	var page=$("#selPage").val();
	var pageRow=$("#selRow").val();
	postData={supVale:$("#supName").val(),order:order,sort:sort,initPage:page,pageRow:pageRow};
	adminSupTypeList();
}
function goPage(){
	var page=$("#selPage").val();
	var pageRow=$("#selRow").val();
	postData={supVale:$("#supName").val(),status:$("#status").val(),initPage:page,pageRow:pageRow};
	adminSupTypeList();
}
function changePage(page){
	var pageRow=$("#selRow").val();
	postData={supVale:$("#supName").val(),initPage:page,pageRow:pageRow};
	adminSupTypeList();
}
function goRow(){
	var pageRow=$("#selRow").val();
	var page=$("#selPage").val();
	adminSupTypeList();
}
</script>
<%@ include file="/page/common/modal.jsp"%>
<%@ include file="/page/common/admFooter.jsp"%>
</body>
</html>